package com.idea.zd.sys.train.jms;


import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.lang.*;

public class JsmTest {

    public static void main(String [] args){
        /*Provider provider = new Provider();
        provider.init();
        provider.sendMessage("sms_10");

        Consumer consumer = new Consumer();
        consumer.init();
        consumer.getMessage("sms_10");*/

        try {
            URL url = new URL("http://www.ideazd.com");
            URLConnection urlConnection = url.openConnection();
            InputStream inputStream = urlConnection.getInputStream();

            Reader reader = new InputStreamReader(inputStream,"UTF-8");


            char [] chars = new char[1024];

            int hasRead = 0;

            while((hasRead = reader.read(chars)) >0){
                System.out.println(new String(chars,0,hasRead));
            }


        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}
